package com.party.admin.task;

import com.party.core.service.mall.biz.GoodsShowCountBizService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description: 商品主题/主题类型统计数矫正
 * @Author: yangshoukun
 * @Date: 2018/4/13 11:03
 */
@Component("quartzReviseMallShowSubject")
public class QuartzReviseMallShowSubject {

    private static Logger logger = LoggerFactory.getLogger(QuartzReviseMallShowSubject.class);

    @Autowired
    private GoodsShowCountBizService goodsShowCountBizService;

    /**
     * 矫正
     */
    public void revise() {
        logger.info("矫正主题开始>>>>>>>>>>>>>>>>>>>>>>>>>>");
        // 矫正所有模板的商品数和机构数
        try {
            goodsShowCountBizService.reviseTemplate(null);
        } catch (Exception e) {
            logger.error("矫正所有主题模板的冗余数异常", e);
        }

        // 矫正所有机构主题的商品数
        try {
            goodsShowCountBizService.reviseSubject(null, null);
        } catch (Exception e) {
            logger.error("矫正所有机构模板的冗余数异常", e);
        }
    }
}
